package com.bjc.principle.prototype;

import java.util.Date;

/**
 * @program: DesignPattern
 * @description:
 * @author: bjc
 * @create: 2020-12-23 20:36
 */
//浅拷贝
public class BiLiBiLi {

    public static void main(String[] args) {
        //原型对象
        Date date = new Date();
        Video v1 = new Video("小陈子", date);
        //v1 克隆v2
        //Video v2 = new Video("小陈子", date);
        Video v2 = null;
        try {
            v2 = (Video)v1.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        System.out.println("v1=>"+v1);
        System.out.println("v2=>"+v2);

        System.out.println("=====================");
        date.setTime(22131231);
        System.out.println("v1=>"+v1);
        System.out.println("v2=>"+v2);
    }
}
